@use "helpers";

.examples__navigation {
  display: none;

  @include helpers.breakpoint(640px) {
    width: 200px;
    float: left;
    display: block;
    list-style: none;
    margin: 0;
    margin-right: 20px;
    border: 1px solid #e4e4e4;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
  }
}

@supports (position: sticky) {
  .examples__navigation {
    overflow-y: scroll;
    max-height: 100vh;
    position: sticky;
    top: 0;
  }
}

.examples__navigation-item {
  border-bottom: 1px solid #e4e4e4;

  &:last-child {
    border-bottom: none;
  }

  a {
    padding: 10px;
    color: inherit;
    text-decoration: none;
    display: block;

    &:hover {
      background: #f5f5f5;
      text-decoration: underline;
    }
  }
}

.examples {
  overflow: hidden;
}

.example {
  background-color: #fff;
  border-radius: 4px;
  border: 1px solid #e4e4e4;
  padding: 0 20px;
  padding-top: 20px;
  margin-bottom: 20px;

  &__heading {
    color: #216ba5;
    font-weight: 400;
    font-size: 18px;
    border: 0;
    margin: 0;
    padding: 0;
    margin-bottom: 20px;
  }

  &__tabs {
    display: flex;
  }

  &__tab {
    font-family: "Open Sans", sans-serif;
    box-sizing: border-box;
    padding: 8px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
  }

  &__tab:hover {
    border-bottom: 2px solid #216ba5;
  }

  &__tab.active {
    border-bottom: 2px solid #216ba5;
  }

  &__code {
    position: relative;
    background-color: #f5f8fb;
    padding: 5px;
    margin-left: -20px;
    border-top: 1px solid #d8e4ef;
    border-bottom: 1px solid #d8e4ef;
    overflow: auto hidden;

    @include helpers.breakpoint(768px) {
      width: 70%;
      border-top-right-radius: 4px;
      border-bottom-right-radius: 4px;
      border-right: 1px solid #d8e4ef;
      margin-bottom: 0;
    }

    textarea:focus {
      outline: 0;
    }
  }

  &__actions {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 10;

    & > * {
      width: 20px;
      margin-right: 10px;
      vertical-align: middle;
    }

    &__button {
      width: 38px;
      border-radius: 50%;
      height: 38px;
      border: none;
      background-color: transparent;
      cursor: pointer;

      transition: background 0.2s ease;

      &:hover {
        background: rgba(172, 172, 172, 0.2);
      }

      &:focus {
        background: rgba(172, 172, 172, 0.4);
      }

      & > img {
        width: 18px;
      }
    }
  }

  &__transpiling {
    padding: 0.8rem;
    font-size: 14px;
    color: #666;
    font-family: "Open Sans", sans-serif;
  }

  &__preview {
    padding: 20px;

    @include helpers.breakpoint(768px) {
      width: 30%;
    }

    @media (max-width: 768px) {
      padding-left: 0;
    }
  }

  &#example-portal-by-id {
    position: relative;
    overflow: hidden;
  }
}

.red-border {
  border-color: #f00;
}

.rasta-stripes {
  .react-datepicker__week:nth-child(3n + 1) {
    background-color: #215005;
  }

  .react-datepicker__week:nth-child(3n + 2) {
    background-color: #eea429;
  }

  .react-datepicker__week:nth-child(3n + 3) {
    background-color: #a82a15;
  }
}

.react-datepicker__day.random {
  color: #f00;
}

.react-datepicker__week.highlighted {
  background-color: #ddffdd;
  border-radius: 5px;
}

.example-custom-input {
  cursor: pointer;
  padding: 5px 15px;
  border: 0;
  border-radius: 4px;
  background-color: #216ba5;
  font: inherit;
  color: #fff;
}
